package com.haixiaoke.saas.workOrder.mapper;

import com.haixiaoke.saas.workOrder.domain.WorkOrder;

import java.util.List;
import java.util.Map;

/**
 * 工单Mapper接口
 *
 * @author panda
 * @date 2024-09-02
 */
public interface WorkOrderMapper {
    /**
     * 查询工单
     *
     * @param workOrderId 工单主键
     * @return 工单
     */
    WorkOrder selectWorkOrderByWorkOrderId(String workOrderId);

    /**
     * 查询工单列表
     *
     * @param workOrder 工单
     * @return 工单集合
     */
    List<WorkOrder> selectWorkOrderList(WorkOrder workOrder);

    /**
     * 新增工单
     *
     * @param workOrder 工单
     * @return 结果
     */
    int insertWorkOrder(WorkOrder workOrder);

    /**
     * 修改工单
     *
     * @param workOrder 工单
     * @return 结果
     */
    int updateWorkOrder(WorkOrder workOrder);

    /**
     * 编辑工单--有些字段没有非空校验
     * @param workOrder
     * @return
     */
    int editWorkOrder(WorkOrder workOrder);

    /**
     * 删除工单
     *
     * @param workOrderId 工单主键
     * @return 结果
     */
    int deleteWorkOrderByWorkOrderId(String workOrderId);

    /**
     * 批量删除工单
     *
     * @param workOrderIds 需要删除的数据主键集合
     * @return 结果
     */
    int deleteWorkOrderByWorkOrderIds(String[] workOrderIds);

    /**
     * 小程序查询订单列表
     * @param workOrder 工单
     * @return
     */
    List<WorkOrder> flatSelectWorkOrderList(WorkOrder workOrder);

    /**
     * 查询维修员未完成工单
     * @return
     */
    List<WorkOrder> checkWorkOrder(WorkOrder workOrder);

    /**
     * 小程序删除工单
     * @param workOrderId
     * @return
     */
    int softDeleteWorkOrderByWorkOrderId(String workOrderId);

    /**
     * 查询工单超时任务
     * @return
     */
    List<WorkOrder> workOrderOvertimeTask();

    /**
     * 统计工单状态数量
     */
    List<Map<String, Object>> countWorkOrderState(WorkOrder workOrder);

    /**
     * 统计超时工单数量
     * @param workOrder
     * @return
     */
    int countTimeoutFlag(WorkOrder workOrder);

    /**
     * 更新超时工单状态
     * @param workOrderIdList
     * @return
     */
    int updateOvertimeTask(List<String> workOrderIdList);

    /**
     * 查询维修人员待完成工单列表
     * @param workOrder
     * @return
     */
    List<WorkOrder> selectPendingWorkOrderList(WorkOrder workOrder);

    /**
     * 根据工单id集合查询工单列表
     * @param workOrderIds
     * @return
     */
    List<WorkOrder> selectWorkOrderByWorkOrderIds(List<String> workOrderIds);
}
